package com.sgb.kjwl.api.service;

import com.sgb.kjwl.model.entity.AddShoppingCar;
import com.sgb.kjwl.model.entity.ConcreteEntity;
import com.sgb.kjwl.model.entity.DeleteShoppingCar;
import com.sgb.kjwl.model.entity.ShopGoodsInfoEntity;
import com.sgb.kjwl.model.entity.ShopInfoEntity;
import com.sgb.kjwl.model.entity.ShoppingCarEntity;
import com.sgb.kjwl.model.entity.ShoppingCarRequest;
import com.sgb.kjwl.model.entity.request.CheckGoodsOrderEntity;
import com.sgb.kjwl.model.entity.request.SubmitGoodsOrderEntity;
import com.sgb.kjwl.model.entity.shopping.CartItemPriceEntity;
import com.sgb.kjwl.model.entity.shopping.PurchasingTypeEntity;
import com.sgb.kjwl.model.entity.shopping.ShoppingCarResponse;
import com.sgb.kjwl.model.entity.user.BankInfoEntity;
import com.sgb.kjwl.model.entity.user.CategoryChildEntity;
import com.sgb.kjwl.model.entity.user.CategoryParentsEntity;
import com.sgb.link.entity.InvoiceManagementEntity;
import com.sgb.kjwl.model.entity.user.ReceiptEntity;
import com.sgb.kjwl.model.entity.user.UserAddressEntity;
import com.sgb.kjwl.model.entity.user.UserDefaultAddressEntity;
import com.swgk.core.base.model.entity.ListResponse;
import com.swgk.core.base.model.entity.BaseEntity;

import java.util.List;
import java.util.Map;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by gaowei on 2019/8/3.
 */

public interface ShoppingCarAPI {

    //获取购物车详情
    @FormUrlEncoded
    @POST("v1/app/user/cart/cartList")
    Call<BaseEntity<List<ShoppingCarEntity>>> getShoppingCarEntity(@Field("areacode") String areacode);

    /***
     * 获取购物车列表
     * @param
     * @return
     */
    @POST("v1/app/user/new/cart/getCartList")
    Call<BaseEntity<List<ShoppingCarResponse>>> getShoppingCarEntity();

    //校验购物车的提交价格
    @POST("v1/app/user/cart/checkCartItemPrice")
    Call<BaseEntity> checkCartItemPrice(@Body List<CartItemPriceEntity> cartItemPriceEntities);

    //加入购物车
    @POST("v1/app/user/cart/addCart")
    Call<BaseEntity> addShoppingCar(@Body AddShoppingCar addShoppingCar);

    /***
     *  加入购物车
     */
    @POST("v1/app/user/new/cart/addCart")
    Call<BaseEntity> addShoppingCar(@Body ShoppingCarRequest addShoppingCar);

    //获取购物车数量
    @FormUrlEncoded
    @POST("v1/app/user/cart/cartListCount")
    Call<BaseEntity<String>> getCarCount(@Field("areacode") String areacode);

    /***
     * 根据Userid获取购物车数量
     * @return
     */
    @POST("v1/app/user/new/cart/getCartCount")
    Call<BaseEntity<Integer>> getCarCount();

    /***
     * 根据购物车的id更新商品数量
     */
    @POST("v1/app/user/new/cart/updateCart")
    Call<BaseEntity<Boolean>> getCarCount(@Body Map map);

    /***
     * 根据购物车id 删除购物车商品
     * @param list
     * @return
     */
    @POST("v1/app/user/new/cart/deleteByids")
    Call<BaseEntity> deleteShoppingCar(@Body List<String> list);

    /***
     * 根据用户id删除清空购物车无效商品
     * @param
     * @return
     */
    @POST("v1/app/user/new/cart/deleteInvalidItemByUserId")
    Call<BaseEntity> deleteInvalidationShoppingCar();

    /***
     * 获取用户默认地址
     * @return
     */
    @POST("v1/app/user/new/cart/userAddress")
    Call<BaseEntity<List<UserDefaultAddressEntity>>> getUserDefaultAddress(@Body Map map);

    /***
     * 获取发票信息
     * @return
     */
    @POST("v1/app/user/new/cart/getCompanyByUser")
    Call<BaseEntity<List<InvoiceManagementEntity>>> getInvoiceInfoByUser();

    /***
     * 获取订单采购/收货/装车/卸车/物流选择信息
     * @return
     */
    @POST("v1/app/user/new/cart/getPurchasingMethod")
    Call<BaseEntity<PurchasingTypeEntity>> getPurchasingMethod();

    /***
     * 提交订单
     */
    @POST("v1/app/user/order/saveOrder")
    Call<BaseEntity> saveOrder(@Body SubmitGoodsOrderEntity list);

    //更新购物车
    @POST("v1/app/user/cart/editCart")
    @Deprecated
    Call<BaseEntity<Boolean>> updateShoppingCar(@Body Map map);

    //删除购物车
    @POST("v1/app/user/cart/delByIds")
    Call<BaseEntity> deleteShoppingCar(@Body DeleteShoppingCar deleteShoppingCar);

    //token检验
    @POST("v1/app/login/checkToken")
    Call<BaseEntity> checkToken();

    //获取默认地址
    @POST("v1/app/user/order/queryAddress")
    Call<BaseEntity<UserAddressEntity>> queryAddress();

    //获取发票信息
    @POST("v1/app/user/order/queryInvoiceInfo")
    Call<BaseEntity<BankInfoEntity>> queryInvoiceInfo();

    //店铺详情
    @POST("v1/app/user/store/myStore")
    Call<BaseEntity<ShopInfoEntity>> shopDetail(@Body Map map);

    /****
     * 当前企业在售的商品信息
     * @param map
     * @return
     */
    @POST("v1/app/user/store/queryListByStore")
    Call<BaseEntity<ListResponse<List<ShopGoodsInfoEntity>>>> queryListByStore(@Body Map map);

    //保存店铺信息
    @POST("v1/app/user/store/add")
    Call<BaseEntity> saveShopInfo(@Body ShopInfoEntity shopInfoEntity);

    //店铺主营业务
    @GET("v1/app/user/store/getCategoryList")
    Call<BaseEntity<List<CategoryParentsEntity<List<CategoryChildEntity>>>>> getCategoryList(@Query("areaCode") String areaCode);

    //收款信息列表
    @POST("v1/app/user/receipt")
    Call<BaseEntity<ListResponse<List<ReceiptEntity>>>> receiptList(@Body Map map);

    //编辑收款信息
    @POST("v1/app/user/receipt/update")
    Call<BaseEntity> receiptUpdate(@Body ReceiptEntity receiptEntity);

    //新增收款信息
    @POST("v1/app/user/receipt/add")
    Call<BaseEntity> receiptAdd(@Body ReceiptEntity receiptEntity);

    //删除收款信息
    @POST("v1/app/user/receipt/delete")
    Call<BaseEntity> receiptDelete(@Query("id") String id);

    //获取砼规格信息
    @POST("v1/app/material/getConcreteAttribute")
    Call<BaseEntity<ConcreteEntity>> getConcreteAttribute(@Query("no") String no);

    //添加购物车（商砼）/
    @POST("v1/app/user/cart/addConcreteCart")
    Call<BaseEntity<ConcreteEntity>> addConcreteCart(@Body Map map);


}
